package com.zz.util;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

/**
 * @author zhr
 */
public class ListBuilder<E> {
    private List<E> list = new ArrayList<>();

    public static <E> ListBuilder<E> create(Class<E> clz) {
        return new ListBuilder<>();
    }

    public ListBuilder<E> arrayList() {
        list = new ArrayList<>(list);
        return this;
    }
    public ListBuilder<E> LinkedList() {
        list = new LinkedList<>(list);
        return this;
    }

    public ListBuilder<E> add(E e) {
        list.add(e);
        return this;
    }
    public ListBuilder<E> addAll(List<E> l) {
        list.addAll(l);
        return this;
    }

    public List<E> build() {
        return list;
    }
}
